package fucai.com.fucai.fragment;


import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.astuetz.PagerSlidingTabStrip;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;

import java.util.ArrayList;
import java.util.List;

import fucai.com.fucai.AppBase;
import fucai.com.fucai.R;
import fucai.com.fucai.adapter.ForecaseViewPagerAdapter;
import fucai.com.fucai.adapter.SildingPagerAdapter;

/**
 * A simple {@link Fragment} subclass.
 */

/**
 * @说 明： 这是一个预测的具体实现 这里的作用只是展示数据 因此需要像海哥的那样 使用一个manger类管理
 * @项目名称：fucai
 * @包 名： fucai.com.fucai
 * @类 名： Fucai
 * @创 建人： chenshuangniu
 * @创建时间：2015/12/2 22:56
 * @版 本：v1.0
 * @修 改人：
 * @修改时间：
 * @修改备注：
 */

public class ForecastFragment extends Fragment {

    private RadioGroup rgs;
    @ViewInject(R.id.vp_buy_contanrs)
    private ViewPager viewPager;
    private List<Fragment> fragments;
    private View view;
    @ViewInject(R.id.iv_title_left)
    private ImageView left;
    @ViewInject(R.id.tv_title_right)
    private TextView right;
    @ViewInject(R.id.tv_title_name)
    private TextView name;
    private LayoutInflater inflater;
    private PopupWindow popupWindow;
    private String[] tabtitlsNames = new String[]{"全部", "组六", "组三"};
    @ViewInject(R.id.food_recored_tabs)
    private PagerSlidingTabStrip mslidingTab;
    private SildingPagerAdapter adapter;
    @ViewInject(R.id.upOpenNumber)
    private TextView mUpTestNumber;
    @ViewInject(R.id.upOpenNumber)
    private TextView mUpOpenNumber;
    @ViewInject(R.id.testNumber)
    private TextView mTestNumber;
    @ViewInject(R.id.issueNumber)
    private TextView mIssueNumber;
    @ViewInject(R.id.input)
    private Button mInputTestNumber;
    @ViewInject(R.id.inputIssue)
    private Button mInputIssue;
    @ViewInject(R.id.forecast)
    private Button mForecast;

    public ForecastFragment() {
    }

    public static ForecastFragment getInstance() {
        return new ForecastFragment();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        view = inflater.inflate(R.layout.fragment_forecast, container, false);
        this.inflater = inflater;
        initView();
        return view;
    }

    private void initView() {
        ViewUtils.inject(this, view);
        fragments = new ArrayList<>();
        fragments.add(ConcreteFragment.getInstance("all"));
        fragments.add(ConcreteFragment.getInstance("there"));
        fragments.add(ConcreteFragment.getInstance("six"));
        adapter = new SildingPagerAdapter(getChildFragmentManager(), fragments, tabtitlsNames);
        viewPager.setAdapter(adapter);
        mslidingTab.setViewPager(viewPager);
        mslidingTab.setTextColor(R.color.food_tab_check_selector);
    }

    @OnClick({R.id.inputIssue, R.id.input, R.id.forecast})
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.input:
                break;
            case R.id.inputIssue:
                break;
            case R.id.forecast:
                break;
            default:
                break;
        }
    }

    /**
     * 得到本期试机号
     */
    public void getInputTestNumber() {

    }

    /**
     * 得到期数
     */
    public void getInputIssueNumber() {

    }

    /**
     * 开始预测
     */
    public void startForecast() {

    }

    /**
     * 设置数据
     */
    public void intData() {

    }
}
